//
//  ResumeIntentionInfoModel.m
//  Btpin
//
//  Created by Vic on 2019/4/14.
//  Copyright © 2019 Vic. All rights reserved.
//

#import "ResumeIntentionInfoModel.h"

@implementation ResumeIntentionInfoModel

- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues {
    self.wage = [UIToolsControl dataAnalysis:keyedValues[@"wage"]];
    self.wage_cn = [UIToolsControl dataAnalysis:keyedValues[@"wage_cn"]];
    self.nature = [UIToolsControl dataAnalysis:keyedValues[@"nature"]];
    self.nature_cn = [UIToolsControl dataAnalysis:keyedValues[@"nature_cn"]];
    
    
    self.jobs_id = @"";
    self.jobs_cn = @"";
    self.jobs = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"jobs"] && [keyedValues[@"jobs"] isKindOfClass:[NSArray class]]) {
        for (NSDictionary *dic in keyedValues[@"jobs"]) {
            PublicCategoryElementModel *model = [[PublicCategoryElementModel alloc] init];
            model.id = [UIToolsControl dataAnalysis:dic[@"idstr"]];
            model.name = [UIToolsControl dataAnalysis:dic[@"name"]];
            [self.jobs addObject:model];
            
            self.jobs_id = [NSString stringWithFormat:@"%@,%@", model.id, self.jobs_id];
            self.jobs_cn = [NSString stringWithFormat:@"%@ %@", model.name, self.jobs_cn];
        }
    }
    
    self.district_id = @"";
    self.district_cn = @"";
    self.district = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"district"] && [keyedValues[@"district"] isKindOfClass:[NSArray class]]) {
        for (NSDictionary *dic in keyedValues[@"district"]) {
            PublicCategoryElementModel *model = [[PublicCategoryElementModel alloc] init];
            model.id = [UIToolsControl dataAnalysis:dic[@"idstr"]];
            model.name = [UIToolsControl dataAnalysis:dic[@"name"]];
            [self.district addObject:model];
            
            self.district_id = [NSString stringWithFormat:@"%@,%@", model.id, self.district_id];
            self.district_cn = [NSString stringWithFormat:@"%@ %@", model.name, self.district_cn];
        }
    }
    
    self.trade_id = @"";
    self.trade_cn = @"";
    self.trade = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"trade"] && [keyedValues[@"trade"] isKindOfClass:[NSArray class]]) {
        for (NSDictionary *dic in keyedValues[@"trade"]) {
            PublicCategoryElementModel *model = [[PublicCategoryElementModel alloc] init];
            model.id = [UIToolsControl dataAnalysis:dic[@"idstr"]];
            model.name = [UIToolsControl dataAnalysis:dic[@"name"]];
            [self.trade addObject:model];
            
            self.trade_id = [NSString stringWithFormat:@"%@,%@", model.id, self.trade_id];
            self.trade_cn = [NSString stringWithFormat:@"%@ %@", model.name, self.trade_cn];
        }
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}

- (id)copyWithZone:(NSZone *)zone {
    ResumeIntentionInfoModel *model = [[[self class] allocWithZone:zone] init];
    model.wage = self.wage;
    model.wage_cn = self.wage_cn;
    model.nature = self.nature;
    model.nature_cn = self.nature_cn;
    
    model.jobs_id = self.jobs_id;
    model.jobs_cn = self.jobs_cn;
    model.jobs = [NSMutableArray arrayWithCapacity:0];
    if (self.jobs && self.jobs.count) {
        for (PublicCategoryElementModel *tempModel in self.jobs) {
            [model.jobs addObject:[tempModel copy]];
        }
    }
    
    model.district_id = self.district_id;
    model.district_cn = self.district_cn;
    model.district = [NSMutableArray arrayWithCapacity:0];
    if (self.district && self.district.count) {
        for (PublicCategoryElementModel *tempModel in self.district) {
            [model.district addObject:[tempModel copy]];
        }
    }
    
    model.trade_id = self.trade_id;
    model.trade_cn = self.trade_cn;
    model.trade = [NSMutableArray arrayWithCapacity:0];
    if (self.trade && self.trade.count) {
        for (PublicCategoryElementModel *tempModel in self.trade) {
            [model.trade addObject:[tempModel copy]];
        }
    }
    
    return model;
}

@end
